package com.ldzl.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 
 * @TableName basic_units
 */
@TableName(value ="basic_units")
@Data
public class BasicUnits implements Serializable {
    /**
     * 计量单位id
     */
    @TableId(type = IdType.AUTO)
    private Long unit_id;

    /**
     * 单位编码
     */
    private String unit_code;

    /**
     * 单位名称
     */
    private String unit_name;

    /**
     * 是否为主单位（0：不是主单位；1：是主单位）
     */
    private Integer isPrimary_unit;

    /**
     * 与主单位的换算比例
     */
    private BigDecimal conversionrate;

    /**
     * 是否启用 (1：启用；0：不启用）
     */
    private String unit_status;

    /**
     * 备注
     */
    private String remarks;

    /**
     * 逻辑删除
     */
    private Integer is_delete;

    /**
     * 创建人
     */
    private String create_by;

    /**
     * 创建时间
     */
    private Date create_time;

    /**
     * 更新人
     */
    private String update_by;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date update_time;

    /**
     * 所属主单位名称
     */
    private String main_unit;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BasicUnits other = (BasicUnits) that;
        return (this.getUnit_id() == null ? other.getUnit_id() == null : this.getUnit_id().equals(other.getUnit_id()))
            && (this.getUnit_code() == null ? other.getUnit_code() == null : this.getUnit_code().equals(other.getUnit_code()))
            && (this.getUnit_name() == null ? other.getUnit_name() == null : this.getUnit_name().equals(other.getUnit_name()))
            && (this.getIsPrimary_unit() == null ? other.getIsPrimary_unit() == null : this.getIsPrimary_unit().equals(other.getIsPrimary_unit()))
            && (this.getConversionrate() == null ? other.getConversionrate() == null : this.getConversionrate().equals(other.getConversionrate()))
            && (this.getUnit_status() == null ? other.getUnit_status() == null : this.getUnit_status().equals(other.getUnit_status()))
            && (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()))
            && (this.getIs_delete() == null ? other.getIs_delete() == null : this.getIs_delete().equals(other.getIs_delete()))
            && (this.getCreate_by() == null ? other.getCreate_by() == null : this.getCreate_by().equals(other.getCreate_by()))
            && (this.getCreate_time() == null ? other.getCreate_time() == null : this.getCreate_time().equals(other.getCreate_time()))
            && (this.getUpdate_by() == null ? other.getUpdate_by() == null : this.getUpdate_by().equals(other.getUpdate_by()))
            && (this.getUpdate_time() == null ? other.getUpdate_time() == null : this.getUpdate_time().equals(other.getUpdate_time()))
            && (this.getMain_unit() == null ? other.getMain_unit() == null : this.getMain_unit().equals(other.getMain_unit()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUnit_id() == null) ? 0 : getUnit_id().hashCode());
        result = prime * result + ((getUnit_code() == null) ? 0 : getUnit_code().hashCode());
        result = prime * result + ((getUnit_name() == null) ? 0 : getUnit_name().hashCode());
        result = prime * result + ((getIsPrimary_unit() == null) ? 0 : getIsPrimary_unit().hashCode());
        result = prime * result + ((getConversionrate() == null) ? 0 : getConversionrate().hashCode());
        result = prime * result + ((getUnit_status() == null) ? 0 : getUnit_status().hashCode());
        result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode());
        result = prime * result + ((getIs_delete() == null) ? 0 : getIs_delete().hashCode());
        result = prime * result + ((getCreate_by() == null) ? 0 : getCreate_by().hashCode());
        result = prime * result + ((getCreate_time() == null) ? 0 : getCreate_time().hashCode());
        result = prime * result + ((getUpdate_by() == null) ? 0 : getUpdate_by().hashCode());
        result = prime * result + ((getUpdate_time() == null) ? 0 : getUpdate_time().hashCode());
        result = prime * result + ((getMain_unit() == null) ? 0 : getMain_unit().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", unit_id=").append(unit_id);
        sb.append(", unit_code=").append(unit_code);
        sb.append(", unit_name=").append(unit_name);
        sb.append(", isPrimary_unit=").append(isPrimary_unit);
        sb.append(", conversionrate=").append(conversionrate);
        sb.append(", unit_status=").append(unit_status);
        sb.append(", remarks=").append(remarks);
        sb.append(", is_delete=").append(is_delete);
        sb.append(", create_by=").append(create_by);
        sb.append(", create_time=").append(create_time);
        sb.append(", update_by=").append(update_by);
        sb.append(", update_time=").append(update_time);
        sb.append(", main_unit=").append(main_unit);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}